﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using CubeDAL;
using SysInfo;

namespace importExcel
{
    class ClearAll
    {
        public static void clear(int type)
        {
            string[] files = { "yuqing.sql","rumor.sql","weibo_event.sql"};
            MySQLWrapper wrapper = new MySQLWrapper(Constant.DB_SERVER, Constant.DB_DATABASE, Constant.DB_USER, Constant.DB_PASSWORD);
            if (type == 2)
            {
                FileInfo file = new FileInfo("tables\\"+"weibo_celebrity.sql");
                string script = file.OpenText().ReadToEnd();
                wrapper.Insert(script);
            }
            FileInfo f = new FileInfo("tables\\"+files[type]);
            string s = f.OpenText().ReadToEnd();
            wrapper.Insert(s);
            f = new FileInfo(@"tables\mapping.sql");
            s = f.OpenText().ReadToEnd();
            wrapper.Insert(s);
            f = new FileInfo(@"tables\mapping_2nd.sql");
            s = f.OpenText().ReadToEnd();
            wrapper.Insert(s);
        }
    }
}
